/*
 * HTTPClient.java
 *
 * Created on 5 listopad 2007, 15:28
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package kosciak.blip4j.utils.http;

import java.io.IOException;
import java.util.List;
import org.apache.commons.codec.EncoderException;

/**
 *
 * @author Wojtek 'KosciaK' Pietrzok
 */
public interface HTTPClient {
    /**
     * Adds request header
     * 
     * @param header a request header
     */
    void addRequestHeader(Header header);

    /**
     * Adds request header
     * 
     * @param key a name of header
     * @param value a value of a header
     */
    void addRequestHeader(String key, String value);

    /**
     * Adds a List of request headers
     * 
     * @param headers a List of request headers
     */
    void addRequestHeaders(List<Header> headers);

    /**
     * Performs GET request
     * 
     * @param file a file to request
     * @return a HTTP response
     * @throws java.io.IOException if an error occurs
     */
    HTTPResponse doGET(String file) throws IOException;

    /**
     * Performs POST request
     * 
     * @param file a file to request
     * @param content a content of a request
     * @return a HTTP response
     * @throws java.io.IOException if an error occurs
     */
    HTTPResponse doPOST(String file, String content) throws IOException;

    /**
     * Sets Basic authentication
     * 
     * @param username an username
     * @param password a password
     * @throws org.apache.commons.codec.EncoderException if an error occurs while Encoding username and password with Base64
     */
    void setBasicAuthentication(String username, String password) throws EncoderException;
    
}
